<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8">
		<?php $this->load->view('layout/Header'); ?>
	    <?php $this->load->view('layout/Modal'); ?>
	    <link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>Resources/Styles/Shop_Cart.css" />
	    <link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>Resources/Styles/Payment.css" />
	    <script type="text/javascript" src="<?php echo base_url(); ?>Resources/Scripts/Payment.js"></script>

		<title>DotA 2 Shop</title>
	    
	</head>
	<body>

		<!-- Menu bar -->

		<?php $this->load->view('layout/Navbar'); ?>

		<!-- End Menu -->

		<!-- Content -->
		<div class="row">
			<div class="col-md-2"></div>
			<div class="col-md-8">
				<div class="container">
		            <div class="row bs-wizard" style="border-bottom:0;">
		                <div class="col-xs-3 bs-wizard-step complete">
		                  <div class="text-center bs-wizard-stepnum">Step 1</div>
		                  <div class="progress"><div class="progress-bar"></div></div>
		                  <a href="#" class="bs-wizard-dot"></a>
		                  <div class="bs-wizard-info text-center">Cart</div>
		                </div>
		                
		                <div class="col-xs-3 bs-wizard-step complete">
		                  <div class="text-center bs-wizard-stepnum">Step 2</div>
		                  <div class="progress"><div class="progress-bar"></div></div>
		                  <a href="#" class="bs-wizard-dot"></a>
		                  <div class="bs-wizard-info text-center">Payment</div>
		                </div>
		                
		                <div class="col-xs-3 bs-wizard-step active">
		                  <div class="text-center bs-wizard-stepnum">Step 3</div>
		                  <div class="progress"><div class="progress-bar"></div></div>
		                  <a href="#" class="bs-wizard-dot"></a>
		                  <div class="bs-wizard-info text-center">Complete</div>
		                </div>

		            </div>
				</div>
			</div>
		</div>

		<div class="row">
			<div class="col-md-2"></div>
			<div class="col-md-8">
				<div id="complete-payment">
					<div id="header" style="border-bottom: 1px solid gray;">
						<?php if ($isdone): ?>
							<h1>Congratulations</h1>
						<?php else: ?>
							<h1>Sorry</h1>
						<?php endif; ?>
					</div>
					<div id="body">
						<!-- Thanh toán qua ATM hoặc Ibanking -->
						<?php if ($isdone): ?>
							<?php if($type == 'ATM' || $type == 'IB' ): ?>
								<div id="ATM-IBANKING">
									<?php if($type == 'ATM'): ?>
										<table style="border-bottom: 1px solid gray;">
											<thead>
												<tr>
													<td colspan="4"><h3>My Invoice Cart</h3></td>
												</tr>
												<tr class="tableheader">
													<td>ITEM</td>
													<td width="15%">PRICE</td>
													<td width="5%">QUANTITY</td>
													<td>SUB TOTAL</td>
												</tr>
											</thead>
											<tbody>
											<?php if(is_array($invoice_details)): ?>
												<?php foreach ($invoice_details as $items): ?>
													<tr class="iteminfo">
														<td>
															<div class='row'>
										                    	<div class="col-md-4">
											                    	<div class="Image-item">
												         	           	<img class="productimage" src="<?php print $items->ITEM_IMAGE; ?>">
											                    	</div>
										                    	</div>
										                    	<div class="col-md-8">
											                    	<div class="Info-item">
													                    <p class="productinfo" id="nameitem"><small><b><?php print $items->ITEM_NAME; ?></b></small></p>
												                    </div>
											                    </div>
										                    </div>
														</td>
														<td>
														<p class="productprice"><b><small><?php if($items->PRICE != '') {$saleoff = 1;
												        if($items->IS_SALE == 0)
												        {
												            $sample_data = $this->m_item->get_new_saleoff_chung();
												            $saleoff = $sample_data[0]->SAMPLE_VALUE;
												        }
												        else if($items->IS_SALE == 1)
												        {
												            $saleoff = $this->m_item->get_new_saleoff_by_itemid($masp);
												        }
												        echo $items->PRICE * $saleoff ;} else {$saleoff = 1;
												        if($items->IS_SALE == 0)
												        {
												            $sample_data = $this->m_item->get_new_saleoff_chung();
												            $saleoff = $sample_data[0]->SAMPLE_VALUE;
												        }
												        else if($items->IS_SALE == 1)
												        {
												            $saleoff = $this->m_item->get_new_saleoff_by_itemid($masp);
												        }
												        echo $items->PRICEVN * $saleoff;} ?> VND</small></b></p>
													</td>
													<td>
													    <div class="input-group">
													    	<?php echo form_input(array('readonly' =>'readonly', 'class' => 'input-number', 'id' => 'qty','name' => '_qty', 'value' => $items->QUANTITY, 'maxlength' => '3', 'size' => '5', 'style'=>"text-align:center; color:black;")); ?>
													    </div>
													</td>
													<td>
														<p class="productprice"><b><small><?php if($items->PRICE != '') {$saleoff = 1;
												        if($items->IS_SALE == 0)
												        {
												            $sample_data = $this->m_item->get_new_saleoff_chung();
												            $saleoff = $sample_data[0]->SAMPLE_VALUE;
												        }
												        else if($items->IS_SALE == 1)
												        {
												            $saleoff = $this->m_item->get_new_saleoff_by_itemid($masp);
												        }
												        echo $items->PRICE * $items->QUANTITY * $saleoff ;} else {$saleoff = 1;
												        if($items->IS_SALE == 0)
												        {
												            $sample_data = $this->m_item->get_new_saleoff_chung();
												            $saleoff = $sample_data[0]->SAMPLE_VALUE;
												        }
												        else if($items->IS_SALE == 1)
												        {
												            $saleoff = $this->m_item->get_new_saleoff_by_itemid($masp);
												        }
												        echo $items->PRICEVN * $items->QUANTITY * $saleoff;} ?> VND</small></b></p>
													</td>
													</tr>
												<?php endforeach; ?>
											<?php endif; ?>
											</tbody>
											<tfoot>
												<tr>
													<td colspan="4" style="padding-right: 7%; text-align:right;" >
														<br/>
														<p class="productprice"><b>Total: <?php echo $total; ?> VND</b></p>
													</td>
												</tr>
											</tfoot>
										</table>
										<h3 style="border-bottom: 1px solid gray;">
											Bạn vui lòng thanh toán qua ngân hàng đã chọn. Đơn hàng sẽ được xử lý trong vòng 24h, sau khi xác nhận chúng tôi sẽ tiến hành liên lạc và giao dịch đồ cho bạn.
										</h3>
									<?php else: ?>
										<table style="border-bottom: 1px solid gray;">
											<thead>
												<tr>
													<td colspan="4"><h3>My Invoice Cart</h3></td>
												</tr>
												<tr class="tableheader">
													<td>ITEM</td>
													<td width="15%">PRICE</td>
													<td width="5%">QUANTITY</td>
													<td>SUB TOTAL</td>
												</tr>
											</thead>
											<tbody>
											<?php if(is_array($invoice_details)): ?>
												<?php foreach ($invoice_details as $items): ?>
													<tr class="iteminfo">
														<td>
										                    <div class='row'>
										                    	<div class="col-md-4">
											                    	<div class="Image-item">
												         	           	<img class="productimage" src="<?php print $items->ITEM_IMAGE; ?>">
											                    	</div>
										                    	</div>
										                    	<div class="col-md-8">
											                    	<div class="Info-item">
													                    <p class="productinfo" id="nameitem"><small><b><?php print $items->ITEM_NAME; ?></b></small></p>
												                    </div>
											                    </div>
										                    </div>
														</td>
														<td>
														<p class="productprice"><b><small><?php if($items->PRICE != '') {$saleoff = 1;
												        if($items->IS_SALE == 0)
												        {
												            $sample_data = $this->m_item->get_new_saleoff_chung();
												            $saleoff = $sample_data[0]->SAMPLE_VALUE;
												        }
												        else if($items->IS_SALE == 1)
												        {
												            $saleoff = $this->m_item->get_new_saleoff_by_itemid($masp);
												        }
												        echo $items->PRICE * $saleoff ;} else {$saleoff = 1;
												        if($items->IS_SALE == 0)
												        {
												            $sample_data = $this->m_item->get_new_saleoff_chung();
												            $saleoff = $sample_data[0]->SAMPLE_VALUE;
												        }
												        else if($items->IS_SALE == 1)
												        {
												            $saleoff = $this->m_item->get_new_saleoff_by_itemid($masp);
												        }
												        echo $items->PRICEVN * $saleoff;} ?> VND</small></b></p>
													</td>
													<td>
													    <div class="input-group">
													    	<?php echo form_input(array('readonly' =>'readonly', 'class' => 'input-number', 'id' => 'qty','name' => '_qty', 'value' => $items->QUANTITY, 'maxlength' => '3', 'size' => '5', 'style'=>"text-align:center; color:black;")); ?>
													    </div>
													</td>
													<td>
														<p class="productprice"><b><small><?php if($items->PRICE != '') {$saleoff = 1;
												        if($items->IS_SALE == 0)
												        {
												            $sample_data = $this->m_item->get_new_saleoff_chung();
												            $saleoff = $sample_data[0]->SAMPLE_VALUE;
												        }
												        else if($items->IS_SALE == 1)
												        {
												            $saleoff = $this->m_item->get_new_saleoff_by_itemid($masp);
												        }
												        echo $items->PRICE * $items->QUANTITY * $saleoff ;} else {$saleoff = 1;
												        if($items->IS_SALE == 0)
												        {
												            $sample_data = $this->m_item->get_new_saleoff_chung();
												            $saleoff = $sample_data[0]->SAMPLE_VALUE;
												        }
												        else if($items->IS_SALE == 1)
												        {
												            $saleoff = $this->m_item->get_new_saleoff_by_itemid($masp);
												        }
												        echo $items->PRICEVN * $items->QUANTITY * $saleoff;} ?> VND</small></b></p>
													</td>
													</tr>
												<?php endforeach; ?>
											<?php endif; ?>
											</tbody>
											<tfoot>
												<tr>
													<td colspan="4" style="padding-right: 7%; text-align:right;" >
														<br/>
														<p class="productprice"><b>Total: <?php echo $total; ?> VND</b></p>
													</td>
												</tr>
											</tfoot>
										</table>
										<h3 style="border-bottom: 1px solid gray;">
											Bạn vui lòng thanh toán qua ngân hàng đã chọn. Đơn hàng sẽ được xử lý trong vòng 24h, sau khi xác nhận chúng tôi sẽ tiến hành liên lạc và giao dịch đồ cho bạn.
										</h3>
										<h4>
											Nội dung thanh toán:
										</h4>
										<p>Tên người gửi ( Nếu nhờ người gửi hộ ): ....</p>
										<p>Thanh toán hóa đơn #<?php print $invoice_id; ?> cho tài khoản <?php print $this->session->userdata('username'); ?> với số tiền là $<?php print $total; ?> VND</p>
									<?php endif; ?>
								</div>
							<?php endif; ?>

							<!-- Thanh toán qua Bảo kim -->
							<?php if($type == 'BK'): ?>
								<div id="BAOKIM">
									<h3 style="border-bottom: 1px solid gray;">
										Đơn hàng sẽ được xử lý trong vòng 24h, sau khi xác nhận chúng tôi sẽ tiến hành liên lạc và giao dịch đồ cho bạn.
									</h3>
								</div>
							<?php endif; ?>

							<!-- Thanh toán qua Wallet -->
							<?php if($type == 'WALLET'): ?>
								<div id="WALLET">
									<table style="border-bottom: 1px solid gray;">
										<thead>
											<tr>
												<td colspan="4"><h3>My Invoice Cart</h3></td>
											</tr>
											<tr class="tableheader">
												<td>ITEM</td>
												<td width="15%">PRICE</td>
												<td width="5%">QUANTITY</td>
												<td>SUB TOTAL</td>
											</tr>
										</thead>
										<tbody>
										<?php if(is_array($invoice_details)): ?>
											<?php foreach ($invoice_details as $items): ?>
												<tr class="iteminfo">
													<td>
														<div class='row'>
									                    	<div class="col-md-4">
										                    	<div class="Image-item">
											         	           	<img class="productimage" src="<?php print $items->ITEM_IMAGE; ?>">
										                    	</div>
									                    	</div>
									                    	<div class="col-md-8">
										                    	<div class="Info-item">
												                    <p class="productinfo" id="nameitem"><small><b><?php print $items->ITEM_NAME; ?></b></small></p>
											                    </div>
										                    </div>
									                    </div>
													</td>
													<td>
														<p class="productprice"><b><small><?php if($items->PRICE != '') {$saleoff = 1;
												        if($items->IS_SALE == 0)
												        {
												            $sample_data = $this->m_item->get_new_saleoff_chung();
												            $saleoff = $sample_data[0]->SAMPLE_VALUE;
												        }
												        else if($items->IS_SALE == 1)
												        {
												            $saleoff = $this->m_item->get_new_saleoff_by_itemid($masp);
												        }
												        echo $items->PRICE * $saleoff ;} else {$saleoff = 1;
												        if($items->IS_SALE == 0)
												        {
												            $sample_data = $this->m_item->get_new_saleoff_chung();
												            $saleoff = $sample_data[0]->SAMPLE_VALUE;
												        }
												        else if($items->IS_SALE == 1)
												        {
												            $saleoff = $this->m_item->get_new_saleoff_by_itemid($masp);
												        }
												        echo $items->PRICEVN * $saleoff;} ?> VND</small></b></p>
													</td>
													<td>
													    <div class="input-group">
													    	<?php echo form_input(array('readonly' =>'readonly', 'class' => 'input-number', 'id' => 'qty','name' => '_qty', 'value' => $items->QUANTITY, 'maxlength' => '3', 'size' => '5', 'style'=>"text-align:center; color:black;")); ?>
													    </div>
													</td>
													<td>
														<p class="productprice"><b><small><?php if($items->PRICE != '') {$saleoff = 1;
												        if($items->IS_SALE == 0)
												        {
												            $sample_data = $this->m_item->get_new_saleoff_chung();
												            $saleoff = $sample_data[0]->SAMPLE_VALUE;
												        }
												        else if($items->IS_SALE == 1)
												        {
												            $saleoff = $this->m_item->get_new_saleoff_by_itemid($masp);
												        }
												        echo $items->PRICE * $items->QUANTITY * $saleoff ;} else {$saleoff = 1;
												        if($items->IS_SALE == 0)
												        {
												            $sample_data = $this->m_item->get_new_saleoff_chung();
												            $saleoff = $sample_data[0]->SAMPLE_VALUE;
												        }
												        else if($items->IS_SALE == 1)
												        {
												            $saleoff = $this->m_item->get_new_saleoff_by_itemid($masp);
												        }
												        echo $items->PRICEVN * $items->QUANTITY * $saleoff;} ?> VND</small></b></p>
													</td>
												</tr>
											<?php endforeach; ?>
										<?php endif; ?>
										</tbody>
										<tfoot>
											<tr>
												<td colspan="4" style="padding-right: 7%; text-align:right;" >
													<br/>
													<p class="productprice"><b>Total: <?php echo $total; ?> VND</b></p>
												</td>
											</tr>
										</tfoot>
									</table>
									<h3 style="border-bottom: 1px solid gray;">
										Đơn hàng sẽ được xử lý trong vòng 24h, sau khi xác nhận chúng tôi sẽ tiến hành liên lạc và giao dịch đồ cho bạn.
									</h3>
									<p>Tổng số tiền cần thanh toán : <?php print $total; ?> VND</p>
									<p>Wallet trước khi thanh toán: <?php print $this->session->userdata('wallet') + $total; ?> VND</p>
									<p>Wallet sau khi thanh toán: <?php print $this->session->userdata('wallet'); ?></p>
								</div>
							<?php endif; ?>

							<!-- Thanh toán qua chuyển khoản -->
							<?php if($type == 'CK'): ?>
								<div id="CHUYENKHOAN">
									<table style="border-bottom: 1px solid gray;">
										<thead>
											<tr>
												<td colspan="4"><h3>My Invoice Cart</h3></td>
											</tr>
											<tr class="tableheader">
												<td>ITEM</td>
												<td width="15%">PRICE</td>
												<td width="5%">QUANTITY</td>
												<td>SUB TOTAL</td>
											</tr>
										</thead>
										<tbody>
										<?php if(is_array($invoice_details)): ?>
											<?php foreach ($invoice_details as $items): ?>
												<tr class="iteminfo">
													<td>
														<div class='row'>
									                    	<div class="col-md-4">
										                    	<div class="Image-item">
											         	           	<img class="productimage" src="<?php print $items->ITEM_IMAGE; ?>">
										                    	</div>
									                    	</div>
									                    	<div class="col-md-8">
										                    	<div class="Info-item">
												                    <p class="productinfo" id="nameitem"><small><b><?php print $items->ITEM_NAME; ?></b></small></p>
											                    </div>
										                    </div>
									                    </div>
													</td>
													<td>
														<p class="productprice"><b><small><?php if($items->PRICE != '') {$saleoff = 1;
												        if($items->IS_SALE == 0)
												        {
												            $sample_data = $this->m_item->get_new_saleoff_chung();
												            $saleoff = $sample_data[0]->SAMPLE_VALUE;
												        }
												        else if($items->IS_SALE == 1)
												        {
												            $saleoff = $this->m_item->get_new_saleoff_by_itemid($masp);
												        }
												        echo $items->PRICE * $saleoff ;} else {$saleoff = 1;
												        if($items->IS_SALE == 0)
												        {
												            $sample_data = $this->m_item->get_new_saleoff_chung();
												            $saleoff = $sample_data[0]->SAMPLE_VALUE;
												        }
												        else if($items->IS_SALE == 1)
												        {
												            $saleoff = $this->m_item->get_new_saleoff_by_itemid($masp);
												        }
												        echo $items->PRICEVN * $saleoff;} ?> VND</small></b></p>
													</td>
													<td>
													    <div class="input-group">
													    	<?php echo form_input(array('readonly' =>'readonly', 'class' => 'input-number', 'id' => 'qty','name' => '_qty', 'value' => $items->QUANTITY, 'maxlength' => '3', 'size' => '5', 'style'=>"text-align:center; color:black;")); ?>
													    </div>
													</td>
													<td>
														<p class="productprice"><b><small><?php if($items->PRICE != '') {$saleoff = 1;
												        if($items->IS_SALE == 0)
												        {
												            $sample_data = $this->m_item->get_new_saleoff_chung();
												            $saleoff = $sample_data[0]->SAMPLE_VALUE;
												        }
												        else if($items->IS_SALE == 1)
												        {
												            $saleoff = $this->m_item->get_new_saleoff_by_itemid($masp);
												        }
												        echo $items->PRICE * $items->QUANTITY * $saleoff ;} else {$saleoff = 1;
												        if($items->IS_SALE == 0)
												        {
												            $sample_data = $this->m_item->get_new_saleoff_chung();
												            $saleoff = $sample_data[0]->SAMPLE_VALUE;
												        }
												        else if($items->IS_SALE == 1)
												        {
												            $saleoff = $this->m_item->get_new_saleoff_by_itemid($masp);
												        }
												        echo $items->PRICEVN * $items->QUANTITY * $saleoff;} ?> VND</small></b></p>
													</td>
												</tr>
											<?php endforeach; ?>
										<?php endif; ?>
										</tbody>
										<tfoot>
											<tr>
												<td colspan="4" style="padding-right: 7%; text-align:right;" >
													<br/>
													<p class="productprice"><b>Total: <?php echo $total; ?> VND</b></p>
												</td>
											</tr>
										</tfoot>
									</table>
									<h3 style="border-bottom: 1px solid gray;">
										Bạn vui lòng thanh toán qua ngân hàng đã chọn. Đơn hàng sẽ được xử lý trong vòng 24h, sau khi xác nhận chúng tôi sẽ tiến hành liên lạc và giao dịch đồ cho bạn.
									</h3>
									<h4>
										Nội dung thanh toán:
									</h4>
									<p>Tên người gửi : ....</p>
									<p>Ngày gửi: ....</p>
									<p>Thanh toán hóa đơn #<?php print $invoice_id; ?> cho tài khoản <?php print $this->session->userdata('username'); ?> với số tiền là <?php print $total; ?> VND</p>
								</div>
							<?php endif; ?>

						<?php else: ?>
							<div id="fail">
								<h3>
									Quá trình tạo đơn hàng bị lỗi, xin vui lòng thử lại sau !
								</h3>
							</div>
						<?php endif; ?>
					</div>
				</div>
			</div>
		</div>

		<!-- Footer -->
		<?php $this->load->view('layout/Footer'); ?>

	</body>
</html>

		<!-- Footer -->
		<?php $this->load->view('layout/Footer'); ?>

	</body>
</html>